import storejs from 'storejs';
/** layout布局 状态管理 **/

// 存储key
const storeKeys = {
    menuCollapseKey: 'menuCollapseKey',
};

const menuList = [
    {
        title: '首页',
        icon: 'el-icon-s-home',
        path: '/',
    },
    {
        title: '大数据',
        icon: 'el-icon-data-line',
        path: '/dataView',
        meta: {
            // 新窗口打开
            newPage: true,
        },
    },
    {
        title: '用户中心',
        icon: 'el-icon-user-solid',
        path: '/apoUser',
        children: [
            {
                title: '用户管理',
                path: '/apoUser',
            }
        ],
    },
    {
        title: '公共场所',
        icon: 'el-icon-office-building',
        path: '/codePlace',
    },
    {
        title: '系统管理',
        icon: 'el-icon-s-tools',
        path: '/system',
        children: [
            {
                title: '系统设置',
                path: '/system/settings',
            },
            {
                title: '管理员',
                path: '/system/sysUser',
            },
            {
                title: '角色管理',
                path: '/system/sysRole',
            },
            {
                title: '权限管理',
                path: '/system/sysPermission',
            },
        ],
    },

];

// 用户状态
const state = {
    // 菜单是否收起
    menuCollapse: storejs.get('?' + storeKeys.menuCollapseKey) ?  storejs.get(storeKeys.menuCollapseKey) : false,
    // 导航菜单数据
    menuList: menuList,
}


const getters = {

}

const mutations = {
    // 设置菜单是否收起
    setMenuCollapse(state, collapse){
        state.menuCollapse = collapse;
        storejs.set(storeKeys.menuCollapseKey, collapse);
    },
}

const actions = {

};

export default {
    namespaced: true,
    state,
    getters,
    mutations,
    actions
}
